package com.example.xianji.utils;

import android.graphics.Bitmap;

import com.example.xianji.widgets.X5WebView;

/**
 * 腾讯X5WebView 的监听
 *
 * @author me
 */
public class MyWebViewClient extends com.tencent.smtt.sdk.WebViewClient {
    private X5WebView x5webview;


    public MyWebViewClient(X5WebView x5webview) {
        super();
        this.x5webview = x5webview;
    }

    @Override
    public void onPageFinished(com.tencent.smtt.sdk.WebView view, String url) {

        view.getSettings().setJavaScriptEnabled(true);

        super.onPageFinished(view, url);

        /**
         * JS代码获取HTML的图片路径
         */
        if (x5webview != null) {
            x5webview.loadUrl(Html_Url.get_url());
        }

    }

    @Override
    public void onPageStarted(com.tencent.smtt.sdk.WebView arg0,
                              String arg1, Bitmap arg2) {
        super.onPageStarted(arg0, arg1, arg2);
    }

    @Override
    public boolean shouldOverrideUrlLoading(
            com.tencent.smtt.sdk.WebView arg0, String arg1) {
        return super.shouldOverrideUrlLoading(arg0, arg1);
    }

    @Override
    public void onReceivedError(com.tencent.smtt.sdk.WebView arg0,
                                int arg1, String arg2, String arg3) {
        super.onReceivedError(arg0, arg1, arg2, arg3);
    }
}
